import {URL} from "./../libs/Url";

/**
 *异步请求SUBJECT
 */
export const SUBJECT = {

    // NEWS
    NEWS: 'REQUEST_SUBJECT_NEWS',
    NEWS_ADD: 'REQUEST_SUBJECT_NEWS_ADD',
    NEWS_CATEGORY: 'REQUEST_SUBJECT_NEWS_CATEGORY',
    NEWS_DETAIL: 'REQUEST_SUBJECT_NEWS_DETAIL',

    //NOTICE
    NOTICE: 'REQUEST_SUBJECT_NOTICE',
    NOTICE_CATEGORY: 'REQUEST_SUBJECT_NOTICE_CATEGORY',

    //ACTIVITY
    ACTIVITY: 'REQUEST_SUBJECT_ACTIVITY',
    ACTIVITY_ADD: 'REQUEST_SUBJECT_ACTIVITY_ADD',
    ACTIVITY_CATEGORY: 'REQUEST_SUBJECT_ACTIVITY_CATEGORY',
    ACTIVITY_DETAIL: 'REQUEST_SUBJECT_ACTIVITY_DETAIL',
    //CLASS
    CLASS_PROFILE: 'REQUEST_SUBJECT_CLASS_PROFILE',
    CLASS_HONOUR: 'REQUEST_SUBJECT_CLASS_HONOUR',

    CLASS_HONOUR_ADD: 'REQUEST_SUBJECT_CLASS_HONOUR_ADD',
    CLASS_HONOUR_DETAIL: 'REQUEST_SUBJECT_CLASS_HONOUR_DETAIL',
    CLASS_TEACHER: 'REQUEST_SUBJECT_CLASS_TEACHER',

    CLASS_STUDENT: 'REQUEST_SUBJECT_CLASS_STUDENT',
    CLASS_STUDENT_ADD: 'REQUEST_SUBJECT_CLASS_STUDENT_ADD',

    HOMEWORK: 'REQUEST_SUBJECT_HOUSEWORK',
    HOMEWORK_ADD: 'REQUEST_SUBJECT_HOUSEWORK_ADD',
    DUTY_ADD: 'REQUEST_SUBJECT_DUTY_ADD',
    SCHEDULE: 'REQUEST_SUBJECT_SCHEDULE',
    SCHEDULE_ADD: 'REQUEST_SUBJECT_SCHEDULE_ADD',
    SCHEDULE_GET: 'REQUEST_SUBJECT_SCHEDULE_GET',

    DAY_NEWS: 'REQUEST_SUBJECT_DAY_NEWS',
    DAY_NEWS_DETAIL: 'REQUEST_SUBJECT_DAY_NEWS_DETAIL',
};

/**
 *PAGE SUBJECT
 */
export const PAGE_SUBJECT = {

    //NEWS
    NEWS: 'PAGE_SUBJECT_NEWS',
    NEWS_CATEGORY: 'PAGE_SUBJECT_NEWS_CATEGORY',
    NEWS_ADD: 'PAGE_SUBJECT_NEWS_ADD',
    NEWS_DETAIL: 'PAGE_SUBJECT_NEWS_DETAIL',

    //NOTICE
    NOTICE: 'PAGE_SUBJECT_NOTICE',
    NOTICE_CATEGORY: 'PAGE_SUBJECT_NOTICE_CATEGORY',
    NOTICE_ADD: 'PAGE_SUBJECT_NOTICE_ADD',

    //ACTIVITYs
    ACTIVITY: 'PAGE_SUBJECT_ACTIVITY',
    ACTIVITY_CATEGORY: 'PAGE_SUBJECT_ACTIVITY_CATEGORY',
    ACTIVITY_ADD: 'PAGE_SUBJECT_ACTIVITY_ADD',
    ACTIVITY_DETAIL: 'PAGE_SUBJECT_ACTIVITY_DETAIL',

    //CLASS
    CLASS_PROFILE: 'PAGE_SUBJECT_CLASS_PROFILE',
    CLASS_HONOUR: 'PAGE_SUBJECT_CLASS_HONOUR',
    CLASS_HONOUR_ADD: 'PAGE_SUBJECT_CLASS_HONOUR_ADD',
    CLASS_HONOUR_DETAIL: 'PAGE_SUBJECT_CLASS_HONOUR_DETAIL',

    CLASS_TEACHER: 'PAGE_SUBJECT_CLASS_TEACHER',
    CLASS_STUDENT: 'PAGE_SUBJECT_CLASS_STUDENT',
    CLASS_PHOTO: 'PAGE_SUBJECT_CLASS_PHOTO',
    CLASS_PHOTO: 'PAGE_SUBJECT_CLASS_PHOTO',
    CLASS_STUDENT_ADD: 'PAGE_SUBJECT_CLASS_STUDENT_ADD',

    HOMEWORK: 'PAGE_SUBJECT_HOUSEWORK',
    HOMEWORK_ADD: 'PAGE_SUBJECT_HOUSEWORK_ADD',
    DUTY_ADD: 'PAGE_SUBJECT_DUTY_ADD',
    SCHEDULE: 'PAGE_SUBJECT_SCHEDULE',
    TEACH_SCHEDULE: 'PAGE_SUBJECT_TEACH_SCHEDULE',

    DAY_NEWS: 'PAGE_SUBJECT_DAY_NEWS',
    DAY_NEWS_ADD: 'PAGE_SUBJECT_DAY_NEWS_ADD',
    DAY_NEWS_DETAIL: 'PAGE_SUBJECT_DAY_NEWS_DETAIL',
};
/**
 * 请求SUBJECT与URL映射
 * @type {{NEWS: string, NEWS_CATEGORY: string}}
 */
export const SUBJECT_MAP_URL = {
    [SUBJECT.NEWS]: {
        ADD: URL.NEWS_ADD,
        FIND: URL.NEWS_FIND,
        DELETE: URL.NEWS_DELETE,
        MODIFY: URL.NEWS_MODIFY,
    },
    [SUBJECT.NEWS_CATEGORY]: {
        FIND: URL.CATEGORY_FIND,
    },
    [SUBJECT.NEWS_DETAIL]: {
        FIND: URL.NEWS_GET,
    },
    //ACTIVITY
    [SUBJECT.ACTIVITY]: {
        ADD: URL.ACTIVITY_ADD,
        FIND: URL.ACTIVITY_FIND,
        DELETE: URL.ACTIVITY_DELETE,
        MODIFY: URL.ACTIVITY_MODIFY,
    },
    [SUBJECT.ACTIVITY_CATEGORY]: {
        FIND: URL.ACTIVITY_CATEGORY_FIND,
    },

    //NOTICE
    [SUBJECT.NOTICE]: {
        ADD: URL.NOTICE_ADD,
        FIND: URL.NOTICE_FIND,
        DELETE: URL.NOTICE_DELETE,
        MODIFY: URL.NOTICE_MODIFY,
    },

    [SUBJECT.CLASS_HONOUR]: {
        FIND: URL.CLASS_HONOUR_FIND,
    },
    [SUBJECT.CLASS_TEACHER]: {
        FIND: URL.CLASS_TEACHER_FIND,
    },
    [SUBJECT.CLASS_STUDENT]: {
        FIND: URL.CLASS_STUDENT_FIND,
        DELETE: URL.CLASS_STUDENT_DELETE,
        ADD: URL.CLASS_STUDENT_ADD,
        MODIFY: URL.CLASS_STUDENT_MODIFY,
    },


    [SUBJECT.HOMEWORK]: {
        FIND: URL.HOMEWORK_FIND,
        DELETE: URL.HOMEWORK_DELETE,
        ADD: URL.HOMEWORK_ADD,
        MODIFY: URL.HOMEWORK_MODIFY,
    },
    [SUBJECT.DAY_NEWS]: {
        FIND: URL.DAY_NEWS_FIND,
        DELETE: URL.DAY_NEWS_DELETE,
        ADD: URL.DAY_NEWS_ADD,
        MODIFY: URL.DAY_NEWS_MODIFY,
    },
};

export var getUrlBySubject = function (subject) {
    return (SUBJECT_MAP_URL[subject]) || {};
}
